<!DOCTYPE html>
<html style="height: 100%">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="Cache-Control" content="no-siteapp">
<link rel="stylesheet" href="../../../static/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../../static/css/public.css" media="all" />
</head>
<body class="childrenBody">
	<form class="layui-form">
		<table id="list" lay-filter="list"></table>
		<div class="list-page" id="page"></div>
	</form>
	<script type="text/javascript" src="../../../static/js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../../../static/layui/layui.js"></script>
	<script type="text/javascript" src="../../../static/custom/js/common.js"></script>
	<script type="text/javascript">
		layui.use([ 'form', 'layer', 'table', 'laypage', 'laydate', 'laytpl'], function() {
			var getRecordsApi = '../../../advisory/customer/getRecords';

			var cols = [ [ {
				field : 'ername',
				title : '跟进人',
				align : "center"
			}, {
				field : 'cname',
				title : '客户',
				align : "center"
			}, {
				field : 'time',
				title : '时间',
				align : "center"
			}, {
				field : 'content',
				title : '内容',
				align : "center"
			}, {
				field : 'type',
				title : '类型',
				align : "center",
				templet : function(d) {
					var str = d.type == 1 ? '主动跟进' : d.type == 2 ? '客户咨询' : '分配跟进人';
					return str;
				}
			} ] ];
			var form = layui.form, layer = parent.layer === undefined ? layui.layer : top.layer;
			var $ = layui.jquery;
			var laytpl = layui.laytpl;
			var laydate = layui.laydate;
			var table = layui.table;
			var laypage = layui.laypage;
			tableIns = table.render({
				elem : '#list',
				cellMinWidth : constant.table.cellMinWidth,
				page : false,
				cols : cols,
				done : function(res, page, count) {
					checkAll(form);
				}
			});
			laydate.render({
				elem : '#time' //指定元素
			});
			//用户列表
			var cid = getUrlParam("id");
			//将id转为json形式
			var jsonData = {};
			jsonData["cid"] = cid;
			var pram = merger(constant.page.toUri(), jsonData);
			listLoad(pram);
			function listLoad(data) {
				loadAjax( getRecordsApi, "get", data, function(response) {
					baseCallBack(response, function(response) {
						table.reload("list", {
							data : response.data.records,
							limit : response.data.records.length
						})
						var page = laypage.render({
							elem : 'page',
							limits : constant.page.limits,
							limit : response.data.size,
							layout : constant.page.layout,
							curr : response.data.current,
							count : response.data.total,
							jump : function(obj, first) {
								if (!first) {
									pram = merger(constant.page.toUri(obj), jsonData);
									listLoad(pram);
								}
							}
						});
						form.render();
					});
				});
			}
		})
	</script>
</body>
</html>